/**
 */
package Entityrelationship.entityrelationship.impl;

import Entityrelationship.entityrelationship.Attribute;
import Entityrelationship.entityrelationship.Attribute_Composite;
import Entityrelationship.entityrelationship.EntityrelationshipPackage;
import Entityrelationship.entityrelationship.TypeAttribute;
import Entityrelationship.entityrelationship.TypeIdentifier;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Attribute</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link Entityrelationship.entityrelationship.impl.AttributeImpl#getName_attribute <em>Name attribute</em>}</li>
 *   <li>{@link Entityrelationship.entityrelationship.impl.AttributeImpl#getType_attribute <em>Type attribute</em>}</li>
 *   <li>{@link Entityrelationship.entityrelationship.impl.AttributeImpl#getIdentifier <em>Identifier</em>}</li>
 *   <li>{@link Entityrelationship.entityrelationship.impl.AttributeImpl#getAttributes_identification <em>Attributes identification</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class AttributeImpl extends A_CompositeImpl implements Attribute {
	/**
	 * The default value of the '{@link #getName_attribute() <em>Name attribute</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName_attribute()
	 * @generated
	 * @ordered
	 */
	protected static final String NAME_ATTRIBUTE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getName_attribute() <em>Name attribute</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName_attribute()
	 * @generated
	 * @ordered
	 */
	protected String name_attribute = NAME_ATTRIBUTE_EDEFAULT;

	/**
	 * The default value of the '{@link #getType_attribute() <em>Type attribute</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getType_attribute()
	 * @generated
	 * @ordered
	 */
	protected static final TypeAttribute TYPE_ATTRIBUTE_EDEFAULT = TypeAttribute.NORMAL;

	/**
	 * The cached value of the '{@link #getType_attribute() <em>Type attribute</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getType_attribute()
	 * @generated
	 * @ordered
	 */
	protected TypeAttribute type_attribute = TYPE_ATTRIBUTE_EDEFAULT;

	/**
	 * The default value of the '{@link #getIdentifier() <em>Identifier</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getIdentifier()
	 * @generated
	 * @ordered
	 */
	protected static final TypeIdentifier IDENTIFIER_EDEFAULT = TypeIdentifier.NO_IDENTIFIER;

	/**
	 * The cached value of the '{@link #getIdentifier() <em>Identifier</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getIdentifier()
	 * @generated
	 * @ordered
	 */
	protected TypeIdentifier identifier = IDENTIFIER_EDEFAULT;

	/**
	 * The cached value of the '{@link #getAttributes_identification() <em>Attributes identification</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getAttributes_identification()
	 * @generated
	 * @ordered
	 */
	protected EList<Attribute> attributes_identification;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected AttributeImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return EntityrelationshipPackage.Literals.ATTRIBUTE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getName_attribute() {
		return name_attribute;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setName_attribute(String newName_attribute) {
		String oldName_attribute = name_attribute;
		name_attribute = newName_attribute;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, EntityrelationshipPackage.ATTRIBUTE__NAME_ATTRIBUTE, oldName_attribute, name_attribute));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TypeAttribute getType_attribute() {
		return type_attribute;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setType_attribute(TypeAttribute newType_attribute) {
		TypeAttribute oldType_attribute = type_attribute;
		type_attribute = newType_attribute == null ? TYPE_ATTRIBUTE_EDEFAULT : newType_attribute;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, EntityrelationshipPackage.ATTRIBUTE__TYPE_ATTRIBUTE, oldType_attribute, type_attribute));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TypeIdentifier getIdentifier() {
		return identifier;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setIdentifier(TypeIdentifier newIdentifier) {
		TypeIdentifier oldIdentifier = identifier;
		identifier = newIdentifier == null ? IDENTIFIER_EDEFAULT : newIdentifier;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, EntityrelationshipPackage.ATTRIBUTE__IDENTIFIER, oldIdentifier, identifier));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Attribute> getAttributes_identification() {
		if (attributes_identification == null) {
			attributes_identification = new EObjectResolvingEList<Attribute>(Attribute.class, this, EntityrelationshipPackage.ATTRIBUTE__ATTRIBUTES_IDENTIFICATION);
		}
		return attributes_identification;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case EntityrelationshipPackage.ATTRIBUTE__NAME_ATTRIBUTE:
				return getName_attribute();
			case EntityrelationshipPackage.ATTRIBUTE__TYPE_ATTRIBUTE:
				return getType_attribute();
			case EntityrelationshipPackage.ATTRIBUTE__IDENTIFIER:
				return getIdentifier();
			case EntityrelationshipPackage.ATTRIBUTE__ATTRIBUTES_IDENTIFICATION:
				return getAttributes_identification();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case EntityrelationshipPackage.ATTRIBUTE__NAME_ATTRIBUTE:
				setName_attribute((String)newValue);
				return;
			case EntityrelationshipPackage.ATTRIBUTE__TYPE_ATTRIBUTE:
				setType_attribute((TypeAttribute)newValue);
				return;
			case EntityrelationshipPackage.ATTRIBUTE__IDENTIFIER:
				setIdentifier((TypeIdentifier)newValue);
				return;
			case EntityrelationshipPackage.ATTRIBUTE__ATTRIBUTES_IDENTIFICATION:
				getAttributes_identification().clear();
				getAttributes_identification().addAll((Collection<? extends Attribute>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case EntityrelationshipPackage.ATTRIBUTE__NAME_ATTRIBUTE:
				setName_attribute(NAME_ATTRIBUTE_EDEFAULT);
				return;
			case EntityrelationshipPackage.ATTRIBUTE__TYPE_ATTRIBUTE:
				setType_attribute(TYPE_ATTRIBUTE_EDEFAULT);
				return;
			case EntityrelationshipPackage.ATTRIBUTE__IDENTIFIER:
				setIdentifier(IDENTIFIER_EDEFAULT);
				return;
			case EntityrelationshipPackage.ATTRIBUTE__ATTRIBUTES_IDENTIFICATION:
				getAttributes_identification().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case EntityrelationshipPackage.ATTRIBUTE__NAME_ATTRIBUTE:
				return NAME_ATTRIBUTE_EDEFAULT == null ? name_attribute != null : !NAME_ATTRIBUTE_EDEFAULT.equals(name_attribute);
			case EntityrelationshipPackage.ATTRIBUTE__TYPE_ATTRIBUTE:
				return type_attribute != TYPE_ATTRIBUTE_EDEFAULT;
			case EntityrelationshipPackage.ATTRIBUTE__IDENTIFIER:
				return identifier != IDENTIFIER_EDEFAULT;
			case EntityrelationshipPackage.ATTRIBUTE__ATTRIBUTES_IDENTIFICATION:
				return attributes_identification != null && !attributes_identification.isEmpty();
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (name_attribute: ");
		result.append(name_attribute);
		result.append(", type_attribute: ");
		result.append(type_attribute);
		result.append(", identifier: ");
		result.append(identifier);
		result.append(')');
		return result.toString();
	}

} //AttributeImpl
